<template>
  <div class="mygame-body">
    <upload @click="uploadgameshow = true"/>
    <template v-for="item in gameinfo">
      <gamecontrolcard :gameinfo="item"/>
    </template>

    <uploadgame v-show="uploadgameshow"/>
  </div>
</template>

<script>
import gamecontrolcard from "./gamecontrolcard.vue";
import upload from "./upload.vue";
import uploadgame from "./uploadgame.vue";
import {mainStore} from "../../../../store";
import {storeToRefs} from 'pinia'
import {mygame} from "../../../api/user";
export default {
  name: "index",
  components:{
    gamecontrolcard,
    upload,
    uploadgame
  },
  data(){
    const { user } = storeToRefs(mainStore())
    return{
      gameinfo:[],
      user,
      uploadgameshow: false
    }
  },
  created() {
    this.getdata()
  },
  methods:{
    getdata(){
      const params = {
        userid: this.user.userid
      }
      console.log(params)
      mygame(params).then(data =>{
        this.gameinfo = data.data
      })
    },
    closegameup(){
      this.uploadgameshow = false
    }
  }
}
</script>

<style scoped>
.mygame-body{
  width: 1500px;
  height: 200px;
  background-color: #fff;
  margin:0 auto;
}
</style>
